

var newer = newer || {};
newer.gd = newer.gd || {};

newer.ContentDiv = function(o) {
	this.domNode = o.domNode;
	
	this.prt = o.prt;
	
	this.init();
};

newer.ContentDiv.prototype= {
	init: function() {
		this.domNode.html("");
		
		this.domNode.removeClass("nw-event-listener").addClass("nw-event-listener");
		this.domNode.off("nw-event").on("nw-event", $.proxy(this.nweHandler,this));
		
		this.refresh();
	},
	
	refresh: function() {
		switch(newer.gd.pstatus.ptype) {
			case newer.UriHelper.PEOPLE_TYPE:
				this.updatePeople();
				break;
			case newer.UriHelper.CIRCLE_TYPE:
				this.updateCircle();
				break;
			default:
		}
	},
	
	nweHandler: function(e,c) {
		if (c.type == newer.EventHelper.PAGE_TYPE) {
			this.refresh();
		}
	},
	
	updatePeople: function() {
		switch(newer.gd.pstatus.tab) {
			case "posts":
				this.content = new newer.PostsDiv({domNode:$("#content-div")});
				break;
			case "friends":
				this.content = new newer.FriendsDiv({domNode:$("#content-div")});
				break;
			case "circles":
				this.content = new newer.CirclesDiv({domNode:$("#content-div")});
				break;
			case "about":
				this.content = new newer.AboutDiv({domNode:$("#content-div")});
				break;
			default:
		}
		// this.content.refresh();
	}, 
	
	updateCircle: function() {
		switch(newer.gd.pstatus.tab) {
			case "posts":
				this.content = new newer.PostsDiv({domNode:$("#content-div")});
				break;
			case "members":
				this.content = new newer.MembersDiv({domNode:$("#content-div")});
				break;
			case "about":
				this.content = new newer.AboutDiv({domNode:$("#content-div")});
			default:
		}
		// this.content.refresh();
	}
};
